program memorytest
	implicit none
	integer(kind=8):: nSize, error = 0
	integer, parameter :: one_mb = 1024*1024
	character, allocatable :: a(:)

	nSize = 0
	
	do while(.true.)
		nSize = nSize + one_mb
		allocate( a(nSize), stat = error )
		write(*,*) error
		if( error /= 0 ) exit
		write(*, "('Allocate ', I20, ' bytes')") nSize
		write(*, "(F15.2,' MBused')") real(nSize)/real(one_mb)
		write(*,*) allocated(a)
		deallocate(a)
	end do

	stop
end program memorytest
